import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '编码',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '语种',
    align:"center",
    dataIndex: 'pkLang'
   },
   {
    title: '时区',
    align:"center",
    dataIndex: 'pkTimezone'
   },
   {
    title: '本位币',
    align:"center",
    dataIndex: 'pkCurrtype'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "编码",
      field: 'code',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "名称",
      field: 'name',
      component: 'Input',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '语种',
    field: 'pkLang',
    component: 'Input',
  },
  {
    label: '时区',
    field: 'pkTimezone',
    component: 'JPopup',
    componentProps: ({ formActionType }) => {
        const {setFieldsValue} = formActionType;
        return{
            setFieldsValue:setFieldsValue,
            code:"bd_timezone",
            fieldConfig: [
                { source: 'name', target: 'pkTimezone' },
            ],
            multi:true
        }
    },

  },
  {
    label: '本位币',
    field: 'pkCurrtype',
    component: 'JPopup',
    componentProps: ({ formActionType }) => {
        const {setFieldsValue} = formActionType;
        return{
            setFieldsValue:setFieldsValue,
            code:"bd_currtype",
            fieldConfig: [
                { source: 'name', target: 'pkCurrtype' },
            ],
            multi:true
        }
    },

  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  code: {title: '编码',order: 0,view: 'text', type: 'string',},
  name: {title: '名称',order: 1,view: 'text', type: 'string',},
  pkLang: {title: '语种',order: 2,view: 'text', type: 'string',},
  pkTimezone: {title: '时区',order: 3,view: 'popup', type: 'string',code: 'bd_timezone', orgFields: 'name', destFields: 'pkTimezone', popupMulti: false,},
  pkCurrtype: {title: '本位币',order: 4,view: 'popup', type: 'string',code: 'bd_currtype', orgFields: 'name', destFields: 'pkCurrtype', popupMulti: false,},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}